[TASK-162] KVReadContext and read path wiring#174
Merged
luoyuxia merged 2 commits intoapache:mainfrom Jan 17, 2026
Merged
Conversation
6bff46b to
8449dac
Compare
Contributor
Author
There was a problem hiding this comment.
Pull request overview
This PR implements the ReadContext pattern and typed row decoding for the KV record read path, mirroring the Java reference implementation. It enables reading KV records with typed CompactedRow access while maintaining performance through decoder caching.
Changes:
- Added
ReadContexttrait andKvRecordReadContextimplementation with efficient double-check locking for decoder caching - Created
RowDecodertrait abstraction withCompactedRowDecoderimplementation for typed row decoding - Modified KV record API to support on-demand typed decoding via
KvRecord::row()method with decoder parameter - Consolidated tests from 19 to 12 while maintaining full coverage, all using the new typed API
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/fluss/src/row/row_decoder.rs | New row decoder trait and CompactedRowDecoder implementation with factory |
| crates/fluss/src/row/mod.rs | Exports new RowDecoder types |
| crates/fluss/src/record/kv/read_context.rs | ReadContext trait for providing schema-specific row decoders |
| crates/fluss/src/record/kv/kv_record_read_context.rs | Production ReadContext implementation with decoder caching |
| crates/fluss/src/record/kv/mod.rs | Module exports and TestReadContext utility for simplified testing |
| crates/fluss/src/record/kv/kv_record.rs | API changes: value_bytes field rename, new row() and is_deletion() methods |
| crates/fluss/src/record/kv/kv_record_batch.rs | API changes: records() now accepts ReadContext, returns KvRecords wrapper |
| crates/fluss/src/record/kv/kv_record_batch_builder.rs | Test consolidation and updates to use typed API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
luoyuxia
reviewed
Jan 17, 2026
Contributor
luoyuxia
left a comment
There was a problem hiding this comment.
@fresh-borzoni Thanks for the pr. Left minor comments. PTAL
Contributor
Author
|
@luoyuxia Thanks for the review |
luoyuxia
approved these changes
Jan 17, 2026
Contributor
luoyuxia
left a comment
There was a problem hiding this comment.
@fresh-borzoni Thanks. LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #162
Implement the ReadContext pattern and typed row decoding for the KV record read path, mirroring the Java reference implementation. This enables reading KV records with typed CompactedRow access while maintaining performance through decoder caching.
Core Infrastructure:
ReadContexttrait for providing schema-specific row decodersKvRecordReadContextwith double-check locking for decoder cachingRowDecodertrait abstraction withCompactedRowDecoderimplementationSchemaGettertrait for fallible schema retrievalAPI Changes:
KvRecordBatch::records()to accept&dyn ReadContextparameterKvRecordto support typed decoding viarow(&dyn RowDecoder)methodKvRecordIterator::row()helper method for ergonomic typed accessKvRecord(no Arc clone per record)Design Decisions:
Test Improvements:
API and Format
API Changes:
ReadContext,SchemaGetter,RowDecodertraitsKvRecordBatch::records()now requires&dyn ReadContextparameterKvRecord::row()returnsOption<CompactedRow<'_>>with decoder parameterKvRecordIterator::row()helper for ergonomic typed accessStorage Format:
Documentation
New Features: